{% extends "base.html" %}
{% load mezzanine_tags keyword_tags article_tags %}
{% block body_id %}article-root{% endblock %}
{% block meta_title %}{{ page.meta_title }}{% endblock %}

{% block meta_keywords %}{% metablock %}
    {% keywords_for page as keywords %}
    {% for keyword in keywords %}
        {% if not forloop.first %}, {% endif %}
        {{ keyword }}
    {% endfor %}
{% endmetablock %}{% endblock %}

{% block meta_description %}{% metablock %}
    {{ page.description }}
{% endmetablock %}{% endblock %}

{% block main %}
    <div class="article-hot hidden-phone row-fluid">
        <div class="article-categories span2">
            <h3>热点文章</h3>
            <ul>
                {% for p in page.children.all %}
                    {% if p.category %}
                        <li><a href="{{ p.get_absolute_url }}">{{ p.title }}</a></li>
                    {% endif %}
                {% endfor %}
            </ul>
        </div>
        <div class="article-hot-articles span10">
            {% get_latest_covered_article page include_children=True as covered_article %}
            <dl>
                <dt><a href="{{ covered_article.get_absolute_url }}">
                    <img src="{{ MEDIA_URL }}{% thumbnail covered_article.cover 185 175 %}"
                         alt="{{ covered_article.title }}">
                </a></dt>
                <dd>
                    <p class="title"><a href="{{ covered_article.get_absolute_url }}">{{ covered_article.title }}</a>
                    </p>

                    <p class="summary">
                        {{ covered_article.description|safe }}
                    </p>
                    {% featured_articles page 5 include_children=True exclude=covered_article %}
                </dd>
            </dl>

        </div>
    </div>
    <div class="clearfix"></div>

    {% for category in page.children.all %}
        {% if forloop.counter0|divisibleby:2 %}
            <div class="row-fluid article-block-row">
        {% endif %}
    <div class="article-block span6">
        <p class="title"><span>{{ category.title }}</span>
            <a href="{{ category.get_absolute_url }}" class="pull-right more">更多 <i class="icon-angle-right"></i></a>
        </p>

        <div class="article-hot">
            {% get_latest_covered_article category as covered_article %}
            {% include 'article/article_hot.html' with covered_article=covered_article %}
        </div>
        {% latest_articles category 5 exclude=covered_article show_date=True %}
    </div>
    {% if forloop.counter0|divisibleby:2 %}

    {% endif %}
    {% if not forloop.counter0|divisibleby:2 or forloop.last %}
        </div>
    {% endif %}
    {% endfor %}
{% endblock %}
